<template>
  <div
    class="detail"
    v-if="movie"
    :style="{ backgroundColor: movie.backgroundColor }"
  >
    <p class="title">
      <span @click="backHome">喵喵影院</span> &nbsp;&gt; &nbsp;{{ movie.nm }}
    </p>
    <div class="movie-detail">
      <img :src="movie.img | wh('220.300')" />
      <div class="main-detail">
        <h5>{{ movie.nm }}</h5>
        <p>{{ movie.enm }}</p>
        <p>
          评分&nbsp;&nbsp;<span>{{ movie.sc }}</span
          >&nbsp;&nbsp;({{ movie.snum }}人评过)
        </p>
        <p>{{ movie.cat }}</p>
        <p>{{ movie.star }}</p>
        <p>{{ movie.pubDesc }}</p>
      </div>
    </div>
    <div class="purchase">特惠购票</div>
    <div class="director"></div>
    <div class="simple">
      <h6>简介</h6>
      <p>{{ movie.dra }}</p>
    </div>
    <div class="propaganda">
      <h5>视频推荐</h5>
      <p>{{ movie.videoName }}</p>
      <video :src="movie.vd" autoplay="autoplay" controls muted></video>
    </div>
    <div class="photos">
      <h5>剧照</h5>
      <div class="photo-img">
        <img
          :src="i | wh('280.186')"
          v-for="(i, index) in movie.photos"
          :key="index"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { getMovieDetails } from '@/api/movieDetails'
export default {
  name: 'Detail',
  data() {
    return {
      movie: null,
    }
  },
  created() {
    const id = this.$route.query.id
    getMovieDetails(id).then((data) => {
      this.movie = data.data.data.movie
      console.log(this.movie)
    })
  },
  methods: {
    backHome() {
      this.$router.back()
    },
  },
}
</script>

<style lang="less" scoped>
.detail {
  color: #ccc;
  padding: 0 40px;

  .photos {
    h5 {
      margin: 0;
      line-height: 50px;
      height: 50px;
      font-size: 18px;
    }
    .photo-img {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      img {
        width: 280px;
        margin: 20px;
      }
    }
  }
  .propaganda {
    width: 100%;
    video {
      width: 100%;
    }
    h5 {
      margin: 0;
      line-height: 50px;
      height: 50px;
      font-size: 18px;
    }
    p {
      margin: 0;
      font-size: 14px;
      line-height: 44px;
    }
  }
  .movie-detail {
    height: 300px;
    font-size: 12px;
    display: flex;
    img {
      width: 220px;
      height: 300px;
      margin-right: 30px;
    }
    .main-detail {
      h5 {
        font-size: 20px;
        margin: 0;
        height: 80px;
        line-height: 60px;
        color: #fff;
      }
      p {
        margin: 0;
        height: 45px;
        line-height: 45px;
        span {
          color: #ffcc00;
          font-size: 16px;
          font-weight: bold;
        }
      }
      button {
        height: 60px;
        border: none;
        background-color: #662988;
      }
    }
  }
  .simple {
    font-size: 15px;
    padding: 40px 0;
    color: #fff;
    h6 {
      font-weight: normal;
      font-size: 16px;
      margin: 20px 0;
    }
    p {
      margin: 0;
      height: 150px;
      width: 100%;
      line-height: 50px;

      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3;
      overflow: hidden;
    }
  }
  .title {
    margin: 0;
    font-size: 14px;
    height: 60px;
    line-height: 60px;
    padding: 20px 0;
    color: #ccc;
  }
  .purchase {
    background: #f03d37;
    height: 80px;
    line-height: 80px;
    font-size: 18px;
    width: 80%;
    text-align: center;
    border-radius: 40px;
    position: fixed;
    bottom: 20px;
    left: 10%;
    z-index: 99;
  }
}
</style>
